// https://nuxt.com/docs/api/configuration/nuxt-config

// import { VitePWA } from "vite-plugin-pwa";

export default defineNuxtConfig({
  plugins: ["~/plugins/eventBus"],
  components: {
    global: true,
    dirs: ["~/components"],
  },
  compatibilityDate: "2024-11-01",
  devtools: { enabled: true },

  modules: ["@nuxt/eslint", "@nuxt/icon", '@nuxtjs/tailwindcss'],

  // 类型检查
  typescript: {
    typeCheck: true
  },

  // 使用 routeRules 来处理代理
  routeRules: {
    '/api-next/**': { 
      proxy: 'http://dhxia.natapp1.cc/**',
      cors: true,
      headers: {
        'Access-Control-Allow-Origin': '*',
        'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
        'Access-Control-Allow-Headers': 'Content-Type, Authorization, Cache-Control',
      }
    }
  },
 
  devServer: {
    https: {
      key: "./localhost+2-key.pem",
      cert: "./localhost+2.pem",
    },
  },
});
